package com.cartoon.adapter;

import android.graphics.Bitmap;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;

import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.blankj.utilcode.util.ImageUtils;
import com.blankj.utilcode.util.LogUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.target.BitmapImageViewTarget;
import com.cartoon.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;


import java.util.List;

import model.CarttonKKContentModel;
import pic.PicLoadManager;

public class KKCarttonReadingContentAdapter extends BaseQuickAdapter<CarttonKKContentModel.DataBean.ComicInfoBean.ComicImagesBean, BaseViewHolder> {


    private LinearLayout linearLayout;
    private ImageView imageView;


    public KKCarttonReadingContentAdapter(int layoutResId, @Nullable @org.jetbrains.annotations.Nullable List<CarttonKKContentModel.DataBean.ComicInfoBean.ComicImagesBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CarttonKKContentModel.DataBean.ComicInfoBean.ComicImagesBean item) {


//        ImageView     iv_reding = helper.itemView.findViewById(R.id.iv_reding);
//        PicLoadManager.loadPicture(item.getUrl(),iv_reding);


        LogUtils.d("漫画是",item.getUrl() +"--------->"+helper.getAdapterPosition() );
        WebView webView = helper.itemView.findViewById(R.id.webView);
        // 启用缩放
        webView.getSettings().setSupportZoom(true);
        // 设置默认缩放比例
//        webView.getSettings().setDefaultZoom(WebSettings.ZoomDensity.CLOSE);
        // 设置WebView加载页面时缩小图片
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        webView.setVerticalScrollBarEnabled(true);
        webView.setHorizontalScrollBarEnabled(false);
        webView.loadUrl(item.getUrl());


    }


}
